<!-- EHR员工信息列表 -->
<template>
  <div>
    <el-form :inline="true" :model="ruleForm" ref="ruleForm">
      <el-form-item label="姓名：">
        <el-input v-model.trim="ruleForm.userName" clearable placeholder="请输入员工姓名"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="searchList" id="monitorEnter">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column type="index" label="序号" align="center" fixed></el-table-column>
      <el-table-column label="姓名" prop="userName"  align="center"></el-table-column>
      <el-table-column label="工号" prop="staffCode" align="center"></el-table-column>
      <el-table-column label="集团" prop="level1" align="center"></el-table-column>
      <el-table-column label="公司名称"  prop="level2" align="center"></el-table-column>
      <el-table-column label="中心/项目"  prop="orgName" align="center"></el-table-column>
      <el-table-column label="部门名称" prop="deptName" align="center"></el-table-column>
      <el-table-column label="编织岗位名称" prop="postName" align="center"></el-table-column>
      <el-table-column label="手机" prop="mobile" align="center"></el-table-column>
      <el-table-column label="是否停用" prop="isStop" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isStop">是</span>
          <span v-else>否</span>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagebar">
      <el-pagination
        background
        layout="total, sizes, prev, pager, next"
        :current-page.sync="ruleForm.pageNum"
        :page-sizes="[10, 30, 50, 100]"
        :page-size="ruleForm.pageSize"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
import utils from "@/common/utils.js";
export default {
  name: "employeeInfo",
  title: "员工信息",
  data() {
    return {
      tableData: [],
      ruleForm: {
        userName: '',
        pageNum: 1,
        pageSize: 10
      },
      total: 0
    };
  },
  created() {
    this.getlist();
  },
  activated() {
    this.getlist();
  },
  methods: {
    searchList() {
      this.ruleForm.pageNum = 1;
      this.getlist();
    },
    getlist() {
      this.$axios.post("/forcrm/ehrUser/userList", this.ruleForm).then(res => {
        this.tableData = res.list;
        this.total = res.total;
      });
    },
    handleSizeChange(val) {
      this.ruleForm.pageSize = val;
      this.getlist();
    },
    handleCurrentChange(val) {
      this.ruleForm.pageNum = val;
      this.getlist();
    }
  }
};
</script>
<style lang="stylus" scoped></style>